package arithmetic2.day07;

import java.util.ArrayList;
import java.util.Objects;

/*
    图的一个节点
 */
public class Node {
    //当前节点的值(编号或者id)
    public int value;
    //当前节点的入度
    public int in;
    //当前节点的出度
    public int out;
    //当前节点的直接子节点
    public ArrayList<Node> nexts;
    //当前节点出发的边
    public ArrayList<Edge> edges;

    public Node(int value) {
        this.value = value;
        this.in = 0;
        this.out = 0;
        this.nexts = new ArrayList<>();
        this.edges = new ArrayList<>();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Node node = (Node) o;
        return value == node.value;
    }

    @Override
    public int hashCode() {
        return Objects.hash(value);
    }
}
